package com.gogowan.agroenterprise.newview;

import android.app.ProgressDialog;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Toast;

import com.gogowan.agroenterprise.LoginActivity;
import com.gogowan.agroenterprise.R;
import com.gogowan.agroenterprise.base.BaseActivity;
import com.gogowan.agroenterprise.contorl.RetrofitUtil.GsonUtil;
import com.gogowan.agroenterprise.contorl.RetrofitUtil.JSON_Tool;
import com.gogowan.agroenterprise.contorl.RetrofitUtil.MyRetrofit;
import com.gogowan.agroenterprise.model.LoginResultInfo;
import com.gogowan.agroenterprise.model.Message;
import com.gogowan.agroenterprise.utils.Utils;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import u.aly.H;

public abstract class BaseListView extends BaseActivity {
    private View HeadView,FootView;
    private LinearLayout HeadLayout,FootLayout;
    private ListView listView;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_listview);
        findViewById(R.id.in_storage_fh_btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        listView=(ListView)findViewById(R.id.listView_Activity_List);
        HeadLayout=(LinearLayout)findViewById(R.id.listView_Activity_HeadLayout);
        FootLayout=(LinearLayout)findViewById(R.id.listView_Activity_footLayout);
        SharedPreferences preferences = getSharedPreferences("LoginINfo", MODE_PRIVATE);
        
        
        InitValue();
        InitView();
    }

    protected abstract void InitValue();

    protected abstract void InitView();

    public void SetHeadView(boolean isFix,int LayoutId){
        HeadView= LayoutInflater.from(this).inflate(LayoutId,null);
        if (isFix){
            listView.addHeaderView(HeadView);
        }else {
            HeadLayout.addView(HeadView);
        }
    }
    public void SetFootView(boolean isFix,int LayoutId){
        FootView= LayoutInflater.from(this).inflate(LayoutId,null);
        if (isFix){
            listView.addFooterView(FootView);
        }else {
            FootLayout.addView(FootView);
        }
    }
    public LinearLayout getHeadLayout(){
        return HeadLayout;
    }
    public LinearLayout getFootLayout(){
        return FootLayout;
    }
    public View getHeadView() {
        return HeadView;
    }

    public View getFootView() {
        return FootView;
    }

    public ListView getListView(){
        return listView;
    }


}
